<?php

/**
 * Action that just displays a given link 
 * if URL contains __ID__ it will be replaced with actual ID of the record
 */
class Am_Grid_Action_Url extends Am_Grid_Action_Abstract
{
    protected $privilege = 'browse';
    protected $url;
	protected $id_temp;
	protected $title_temp;
	protected $isUser;

    public function __construct($id, $title, $url, $target = null)
    {
		
		
	
        $this->id = $id;
        $this->title = $title;
		$this->id_temp = $id;
        $this->title_temp = $title;
		$this->url = $url;
		
		
		
        if ($target) {
            $this->setTarget($target);
        }
		
        parent::__construct();
				
    } 
	
    public function getUrl($record = null, $id = null)
    {
		
	
        return str_replace(array('__ID__', '__ROOT__'), array($id, REL_ROOT_URL), $this->url);
	
	  	  
    }
	public function getIdDownload($record = null, $id = null)
	{
		
		if($record->reports_count <= 0 )
		{
				
			$this->id = "";
		}else{
			$this->id = $this->id_temp;
		}
		return $this->id;
	}
	public function getTitleDownload($record = null, $id = null)
	{
		
		if($record->reports_count <= 0 )
		{
				
			$this->title = "";
		}else{
			$this->title = $this->title_temp;
		}
		return $this->title;
	}
	 
    public function run()
    {
		
		
    }
}